using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;

namespace WebControls
{
    public class SFDataList : DataList,IMultiLanguage
    {
        public void SetData(object parDataSource)
        {
            this.DataSource = parDataSource;
            this.DataBind();
        }
        public override void DataBind()
        {
            base.DataBind();
            ((SFPage)this.Page).SetLanguage(this);
        }
        public delegate bool NeedsDataSourceDelegate();

        public event NeedsDataSourceDelegate NeedsDataSource;
        public bool LoadDataListData()
        {
            if (NeedsDataSource != null)
            {
                return NeedsDataSource();
            }
            else
            {
                return false;
            }
        }

        #region IMultiLanguage Members

        public void SetControlLanguage()
        {
            this.LoadDataListData();
        }

        private bool _IsProtectedForLanguageChange = false;
        public bool IsProtectedForLanguageChange
        {
            get
            {
                return _IsProtectedForLanguageChange;
            }
            set
            {
                _IsProtectedForLanguageChange = value;
            }
        }

        private bool _IsMasterPageControl = false;
        public bool IsMasterPageControl
        {
            get
            {
                return _IsMasterPageControl;
            }
            set
            {
                _IsMasterPageControl = value;
            }
        }

        #endregion
    }
}
